function getTdId(node){
    return $($(node).parents("tr").find("td")[0]).text();
}

function setTopicDetail(data,parent) {
    console.log(data);
    parent.empty();

    if(data.type!=undefined){
        var detail=$("<div><h3>题目</h3>" +
            "<div class='block-border'>\n" +data.question+
            "</div>\n" +
            "<h3>答案</h3>\n" +
            "<div class='block-border topic-answer'>\n" +
            "</div>\n" +
            "<h3>详解</h3>\n" +
            "<div class='block-border'>\n" +data.describe+
            "</div></div>");
        var answer=detail.find(".topic-answer");
        if(data.type==1){
            multipleChoice(answer,data);
        }else if(data.type==2){
            if(data.answer[0]=="正确"){
                answer.append("<p class='answer-select'>正确</p>");
                answer.append("<p>错误</p>");
                console.log(123);
            }else {
                answer.append("<p>正确</p>");
                answer.append("<p class='answer-select'>错误</p>");
            }
        }else {
            for(var i=0;i<data.select.length;i++){
                answer.append("<p>"+data.answer[i]+"</p>")
            }
        }

        parent.append(detail);
    }else {
        parent.append("<h3>阅读题题干</h3>");
        parent.append("<div class='block-border'>"+data[0].question+"</div>");

        for(var i=1;i<data.length;i++){
            var detail=$("<div class='block-border'><h3>题目</h3>" +
                "<div class='block-border'>\n" +data[i].question+
                "</div>\n" +
                "<h3>答案</h3>\n" +
                "<div class='block-border topic-answer'>\n" +
                "</div>\n" +
                "<h3>详解</h3>\n" +
                "<div class='block-border'>\n" +data[i].describe+
                "</div></div>");
            var answer=detail.find(".topic-answer");

            multipleChoice(answer,data[i]);

            parent.append(detail);
        }
    }
}

//选择题
function multipleChoice(answer,data) {
    for(var i=0;i<data.select.length;i++){
        answer.append("<p>"+String.fromCharCode((i+"A".charCodeAt(0)))+".　"+data.select[i]+"</p>");
    }

    for(var i=0;i<data.answer.length;i++){
        answer.children().get(data.answer[i].charCodeAt(0)-"A".charCodeAt(0)).className="answer-select";
    }
}